<?php

namespace App\Observers;

use App\Models\Brand;
use Overtrue\LaravelPinyin\Facades\Pinyin;

class BrandObserver
{
    public function saving(Brand $brand)
    {
        $brand->brand_spelling = Pinyin::sentence($brand->name);
        $brand->tag = mb_strtoupper(substr($brand->brand_spelling, 0, 1));
    }
}